'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let {from_uid,to_uid} = event
	let res = await db.collection('opendb-msg').where({
		from_uid,
		to_uid
	}).get()
	if(res.data.length > 0){
		return res.data[0]
	}else{
		let res1 = await db.collection('opendb-msg').add(event)
		return event
	}
};
